package com.farmpost.ssoservice.rest;

import com.farmpost.ssoservice.common.RespBean;
import com.farmpost.ssoservice.pojo.UserLogin;
import com.farmpost.ssoservice.service.UserInfoServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: jinzewang
 * @date: 2025/3/10 17:29
 */
@RestController
@Slf4j
@RequestMapping("/user")
public class SsoLoginController {

    @Autowired
    private UserInfoServiceImpl iUserInfoService;

    @PostMapping("/login")
    public RespBean login(@RequestBody UserLogin userLogin, HttpServletRequest request) {
        return iUserInfoService.login(userLogin.getUsername(), userLogin.getUserPassword(),userLogin.getCode(), request);
    }
}
